package com.he.demo;

import lombok.extern.slf4j.Slf4j;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;

import javax.xml.namespace.QName;

/**
 * @author heyanjing
 * date:2022-04-19 2022/4/19:22:11
 */
@Slf4j
public class MainTest {
    public static void main(String[] args) throws Exception {
        JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
        Client helloClient = dcf.createClient("http://localhost:8080/cxf/hello?wsdl");

        QName operationName = new QName("http://service.demo.he.com", "sayHello");
        Object[] object = helloClient.invoke(operationName, "<x>1</x>");
        log.info("{}", object); //sayHello 返回 : name 32
        //object = helloClient.invoke("sayHello2", "<x>2</x>");
        //log.info("{}", object); //sayHello 返回 : name 32
    }
}
